﻿#ifndef NctiThread_H
#define NctiThread_H
#include "ncti_dcl_base.h"
#include <functional>
#include <mutex>
namespace NCTI
{
	/**
	* @brief internal use
	*/
	class DECL_NCTI_BASE NctiThread
	{
	public:
		using ThreadFunc = std::function<void(int)>;
		NctiThread(ThreadFunc func);
		~NctiThread();
		void start();
		int getId()const;
	private:
		ThreadFunc m_func;
		static int m_generateId;
		int m_threadId;
	};
	/**
	* @brief use to lock for thread
	*/
	class DECL_NCTI_BASE NctiMutexLock
	{
	public:
		NctiMutexLock(std::mutex* i_pmutex);
		~NctiMutexLock();
		static void SetEnable(bool bVal);
	private:
		std::mutex* m_pmutex;
		static bool g_bEnable;
	};
}
#endif // !NctiThread_H
